<%@ page contentType="text/html;charset=utf-8"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="com.tjtt.gwm.action.ShebeichuzhiAction"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page import="java.util.List"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> 								
	<head> 							
		<%@ include file="../jslib/jquerylib.jsp" %>
	    <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/lhgdialog/lhgcore.lhgdialog.min.js?skin=mac"></script>
        <link href="<%=request.getContextPath() %>/web/style/layout.css" type="text/css" rel="stylesheet"/>
        <link rel="stylesheet" href="<%=request.getContextPath() %>/jslib/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css"/>
        <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/ztree/jquery.ztree.core-3.4.js"></script>
	       <!-- 删除结果信息返回 -->
	    	<c:if test="${requestScope.message!=null}">
				<script type="text/javascript">
	  	 		     alert('<c:out value="${requestScope.message}"></c:out>');
	  	 		     window.close();
	  			</script>
	        </c:if>
	 
	<script type="text/javascript">
			var treeObj;
            var flag = "1";
            var delflag = "1";
            var chaflag = "1";
            var parentId = "";
            var tree_sel=null;
            var selecttreeId='';
            var common_contextPath="<%=common_contextPath%>";
            var common_basePath="<%=common_basePath%>";
             var common_width = window.screen.width-0;
            var common_height = window.screen.height-420;
	$(document).ready(function(){
				//高级搜索需要的js
				buttonStatus=1;
				$("#flip").click(function(){
					if(buttonStatus==1){
						$("#panel").slideToggle("slow");
						$("#flip").toggleClass("btnStatus2");
						buttonStatus=1;
					}
					else{
						$("#panel").slideUp("slow");
						$("#flip").toggleClass("btnStatus2");
					}
			 });
				 //高级搜索结束
				//在用设备查询开始+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
					$("#gridTable").jqGrid({
					url:'<%=request.getContextPath()%>/chuzhitaizhangAction!queryzaiyongdataList.action',
              //	url:actionUrl,
                    datatype: "json",
                    height: 480,
                    autowidth: true, 
                    colNames:['ID','设备名称','部门','存放地点','原因','状态','申请人','申请时间'],
                    colModel:[
                        {name:'ID',index:'ID', width:60, key:true,hidden:true,hidedlg:true}, 
						{name:'EQUNAME',index:'EQUNAME', width:100},								
						{name:'EQUORGNAME',index:'EQUORGNAME', width:50},
						{name:'CFANGDIDIAN',index:'CFANGDIDIAN', width:50},
						{name:'YUANYIN',index:'YUANYIN', width:110},
						{name:'ZHUANGTAI',index:'ZHUANGTAI', width:110},
						{name:'SHENQINREN',index:'SHENQINREN', width:110},
						{name:'SQDATE',index:'SQDATE', width:50}
                    ],
					shrinkToFit:false,
					sortname:'id',
					sortorder:'desc',
					viewrecords:true,
					multiselect: true, // 是否显示复选框
					multiboxonly : true, 
					//gridview: true,  //提升速度
					rownumbers: true,//显示行号
					rownumWidth: 30, //行号的宽度
					rowNum:15,
					rowList:[15,20,50,200,500],
					toolbar: [false,"top"],
					loadComplete: function() {
						
					},
					jsonReader: {
						root:"rows",		// 数据行（默认为：rows）
						page: "page",  	// 当前页
						total: "total",  // 总页数
						records: "records",  // 总记录数
						repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
					},
					prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
					pager:"#gridPager",
					caption: "设备台帐列表"
			});
				jQuery("#gridTable").jqGrid('navGrid','#gridPager',{add:false,edit:false,del:false,search:false,refresh:false});
				jQuery("#gridTable").jqGrid('navButtonAdd','#gridPager',
						{ 	
						caption: "",                          
						onClickButton : function (){                               
						jQuery("#gridTable").jqGrid('setColumns');                           
						}
					}); 
						doResize(); 
			//====================结束
			//设备闲置台帐开始+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			$("#gridTable2").jqGrid({
					url:'<%=request.getContextPath()%>/chuzhitaizhangAction!queryxianzhidataList.action',
              //	url:actionUrl,
                    datatype: "json",
                    height: 480,
                    autowidth: true, 
                    colNames:['ID','设备名称','部门','存放地点','状态','闲置描述','申请人','申请时间'],
                    colModel:[
                        {name:'ID',index:'ID', width:60, key:true,hidden:true,hidedlg:true}, 
						{name:'EQUNAME',index:'EQUNAME', width:100},								
						{name:'EQUORGNAME',index:'EQUORGNAME', width:50},
						{name:'CFANGDIDIAN',index:'CFANGDIDIAN', width:50},
						{name:'STATE',index:'STATE', width:110},
						{name:'XZMIAOSHU',index:'XZMIAOSHU', width:110},
						{name:'SHENQINREN',index:'SHENQINREN', width:110},
						{name:'SQDATE',index:'SQDATE', width:50}
                    ],
					shrinkToFit:false,
					sortname:'id',
					sortorder:'desc',
					viewrecords:true,
					multiselect: true, // 是否显示复选框
					multiboxonly : true, 
					//gridview: true,  //提升速度
					rownumbers: true,//显示行号
					rownumWidth: 30, //行号的宽度
					rowNum:15,
					rowList:[15,20,50,200,500],
					toolbar: [false,"top"],
					loadComplete: function() {
						
					},
					jsonReader: {
						root:"rows",		// 数据行（默认为：rows）
						page: "page",  	// 当前页
						total: "total",  // 总页数
						records: "records",  // 总记录数
						repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
					},
					prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
					pager:"#gridPager2",
					caption: "设备台帐列表"
			});
				jQuery("#gridTable2").jqGrid('navGrid','#gridPager',{add:false,edit:false,del:false,search:false,refresh:false});
				jQuery("#gridTable2").jqGrid('navButtonAdd','#gridPager2',
						{ 	
						caption: "",                          
						onClickButton : function (){                               
						jQuery("#gridTable2").jqGrid('setColumns');                           
						}
					}); 
						doResize2(); 
			//设备闲置台帐结束+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			//设备报废台帐开始+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			$("#gridTable3").jqGrid({
					url:'<%=request.getContextPath()%>/chuzhitaizhangAction!querybaofeidataList.action',
              //	url:actionUrl,
                    datatype: "json",
                    height: 280,
                    autowidth: true, 
                    colNames:['ID','标识号','序号','设备名称','设备编号','购进日期','预计使用年限','原值','状态','部门名称','固定资产编号','数量','单位','功能','申请人','申请日期','评审结论'],
                    colModel:[
                        {name:'ID',index:'ID', width:60, key:true,hidden:true,hidedlg:true}, 
						{name:'IDENTIFICATION_ID',index:'IDENTIFICATION_ID', width:50},								
						{name:'APP_NO',index:'APP_NO', width:50},
						{name:'APP_EQU_NAME',index:'APP_EQU_NAME', width:50},
						{name:'APP_EQU_NO',index:'APP_EQU_NO', width:50},
						{name:'APP_EQU_GJDATE',index:'APP_EQU_GJDATE', width:50},
						{name:'APP_EQU_YJSYNX',index:'APP_EQU_YJSYNX', width:50},
						{name:'APP_SBYZ',index:'APP_SBYZ', width:50},								
						{name:'APP_STATUS',index:'APP_STATUS', width:50},
						{name:'EQU_ORG_NAME',index:'EQU_ORG_NAME', width:50},
						{name:'APP_GDZCNO',index:'APP_GDZCNO', width:50},
						{name:'APP_NUMBER',index:'APP_NUMBER', width:50},
						{name:'APP_UNIT',index:'APP_UNIT', width:50},
						{name:'APP_SBGN',index:'APP_SBGN', width:50},								
						{name:'APP_PERSON',index:'APP_PERSON', width:50},
						{name:'APP_DATE',index:'APP_DATE', width:50},
						{name:'APP_PINGSHENJIELUN',index:'APP_PINGSHENJIELUN', width:50}
                    ],
					shrinkToFit:false,
					sortname:'id',
					sortorder:'desc',
					viewrecords:true,
					multiselect: true, // 是否显示复选框
					multiboxonly : true, 
					//gridview: true,  //提升速度
					rownumbers: true,//显示行号
					rownumWidth: 30, //行号的宽度
					rowNum:15,
					rowList:[15,20,50,200,500],
					toolbar: [false,"top"],
					loadComplete: function() {
						
					},
					jsonReader: {
						root:"rows",		// 数据行（默认为：rows）
						page: "page",  	// 当前页
						total: "total",  // 总页数
						records: "records",  // 总记录数
						repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
					},
					prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
					pager:"#gridPager",
					caption: "设备台帐列表"
			});
				jQuery("#gridTable3").jqGrid('navGrid','#gridPager3',{add:false,edit:false,del:false,search:false,refresh:false});
				jQuery("#gridTable3").jqGrid('navButtonAdd','#gridPager3',
						{ 	
						caption: "",                          
						onClickButton : function (){                               
						jQuery("#gridTable3").jqGrid('setColumns');                           
						}
					}); 
						doResize3(); 
			//设备报废台帐结束+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			//设备禁用台帐开始+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			$("#gridTable4").jqGrid({
					url:'<%=request.getContextPath()%>/chuzhitaizhangAction!queryjinyongdataList.action',
              //	url:actionUrl,
                    datatype: "json",
                    height: 280,
                    autowidth: true, 
                    colNames:['ID','设备名称','部门','存放地点','原因','状态','申请人','申请时间'],
                    colModel:[
                        {name:'ID',index:'ID', width:60, key:true,hidden:true,hidedlg:true}, 
						{name:'EQUNAME',index:'EQUNAME', width:100},								
						{name:'EQUORGNAME',index:'EQUORGNAME', width:50},
						{name:'CFANGDIDIAN',index:'CFANGDIDIAN', width:50},
						{name:'YUANYIN',index:'YUANYIN', width:110},
						{name:'ZHUANGTAI',index:'ZHUANGTAI', width:110},
						{name:'SHENQINREN',index:'SHENQINREN', width:110},
						{name:'SQDATE',index:'SQDATE', width:50}
                    ],
					shrinkToFit:false,
					sortname:'id',
					sortorder:'desc',
					viewrecords:true,
					multiselect: true, // 是否显示复选框
					multiboxonly : true, 
					//gridview: true,  //提升速度
					rownumbers: true,//显示行号
					rownumWidth: 30, //行号的宽度
					rowNum:15,
					rowList:[15,20,50,200,500],
					toolbar: [false,"top"],
					loadComplete: function() {
						
					},
					jsonReader: {
						root:"rows",		// 数据行（默认为：rows）
						page: "page",  	// 当前页
						total: "total",  // 总页数
						records: "records",  // 总记录数
						repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
					},
					prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
					pager:"#gridPager4",
					caption: "设备台帐列表"
			});
				jQuery("#gridTable4").jqGrid('navGrid','#gridPager4',{add:false,edit:false,del:false,search:false,refresh:false});
				jQuery("#gridTable4").jqGrid('navButtonAdd','#gridPager4',
						{ 	
						caption: "",                          
						onClickButton : function (){                               
						jQuery("#gridTable4").jqGrid('setColumns');                           
						}
					}); 
						doResize4(); 
			//设备禁用台帐结束+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			//设备封存台帐开始+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			$("#gridTable5").jqGrid({
					url:'<%=request.getContextPath()%>/chuzhitaizhangAction!queryfengcundataList.action',
              //	url:actionUrl,
                    datatype: "json",
                    height: 280,
                    autowidth: true, 
                    colNames:['ID','设备名称','部门','存放地点','原因','状态','申请人','申请时间'],
                    colModel:[
                        {name:'ID',index:'ID', width:60, key:true,hidden:true,hidedlg:true}, 
						{name:'EQUNAME',index:'EQUNAME', width:100},								
						{name:'EQUORGNAME',index:'EQUORGNAME', width:50},
						{name:'CFANGDIDIAN',index:'CFANGDIDIAN', width:50},
						{name:'YUANYIN',index:'YUANYIN', width:110},
						{name:'ZHUANGTAI',index:'ZHUANGTAI', width:110},
						{name:'SHENQINREN',index:'SHENQINREN', width:110},
						{name:'SQDATE',index:'SQDATE', width:50}
                    ],
					shrinkToFit:false,
					sortname:'id',
					sortorder:'desc',
					viewrecords:true,
					multiselect: true, // 是否显示复选框
					multiboxonly : true, 
					//gridview: true,  //提升速度
					rownumbers: true,//显示行号
					rownumWidth: 30, //行号的宽度
					rowNum:15,
					rowList:[15,20,50,200,500],
					toolbar: [false,"top"],
					loadComplete: function() {
						
					},
					jsonReader: {
						root:"rows",		// 数据行（默认为：rows）
						page: "page",  	// 当前页
						total: "total",  // 总页数
						records: "records",  // 总记录数
						repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
					},
					prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
					pager:"#gridPager5",
					caption: "设备台帐列表"
			});
				jQuery("#gridTable5").jqGrid('navGrid','#gridPager5',{add:false,edit:false,del:false,search:false,refresh:false});
				jQuery("#gridTable5").jqGrid('navButtonAdd','#gridPager5',
						{ 	
						caption: "",                          
						onClickButton : function (){                               
						jQuery("#gridTable").jqGrid('setColumns');                           
						}
					}); 
						doResize5(); 
			//设备封存台帐结束+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			//设备故障台帐开始+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			$("#gridTable6").jqGrid({
					url:'<%=request.getContextPath()%>/chuzhitaizhangAction!queryzaiyongdataList.action',
              //	url:actionUrl,
                    datatype: "json",
                    height: 280,
                    autowidth: true, 
                    colNames:['ID','设备名称','部门','存放地点','原因','状态','申请人','申请时间'],
                    colModel:[
                        {name:'ID',index:'ID', width:60, key:true,hidden:true,hidedlg:true}, 
						{name:'EQUNAME',index:'EQUNAME', width:100},								
						{name:'EQUORGNAME',index:'EQUORGNAME', width:50},
						{name:'CFANGDIDIAN',index:'CFANGDIDIAN', width:50},
						{name:'YUANYIN',index:'YUANYIN', width:110},
						{name:'ZHUANGTAI',index:'ZHUANGTAI', width:110},
						{name:'SHENQINREN',index:'SHENQINREN', width:110},
						{name:'SQDATE',index:'SQDATE', width:50}
                    ],
					shrinkToFit:false,
					sortname:'id',
					sortorder:'desc',
					viewrecords:true,
					multiselect: true, // 是否显示复选框
					multiboxonly : true, 
					//gridview: true,  //提升速度
					rownumbers: true,//显示行号
					rownumWidth: 30, //行号的宽度
					rowNum:15,
					rowList:[15,20,50,200,500],
					toolbar: [false,"top"],
					loadComplete: function() {
						
					},
					jsonReader: {
						root:"rows",		// 数据行（默认为：rows）
						page: "page",  	// 当前页
						total: "total",  // 总页数
						records: "records",  // 总记录数
						repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
					},
					prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
					pager:"#gridPager6",
					caption: "设备台帐列表"
			});
				jQuery("#gridTable6").jqGrid('navGrid','#gridPager6',{add:false,edit:false,del:false,search:false,refresh:false});
				jQuery("#gridTable6").jqGrid('navButtonAdd','#gridPager6',
						{ 	
						caption: "",                          
						onClickButton : function (){                               
						jQuery("#gridTable6").jqGrid('setColumns');                           
						}
					}); 
						doResize6(); 
			//设备故障台帐结束+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			
			}); 
///	
		//执行大小
		function doResize() { 
		var ss = getPageSize(); 
		//alert(ss.WinH);
		
			 $("#gridTable").jqGrid('setGridHeight', ss.WinH-245);
			 $("#gridTable").jqGrid('setGridWidth', ss.WinW-30); 
			}
			//执行大小
		function doResize2() { 
		var ss = getPageSize(); 
		//alert(ss.WinH);
		
			 $("#gridTable2").jqGrid('setGridHeight', ss.WinH-245);
			 $("#gridTable2").jqGrid('setGridWidth', ss.WinW-30); 
			} 
			//执行大小
		function doResize3() { 
		var ss = getPageSize(); 
		//alert(ss.WinH);
		
			 $("#gridTable3").jqGrid('setGridHeight', ss.WinH-245);
			 $("#gridTable3").jqGrid('setGridWidth', ss.WinW-30); 
			} 
			//执行大小
		function doResize4() { 
		var ss = getPageSize(); 
		//alert(ss.WinH);
		
			 $("#gridTable4").jqGrid('setGridHeight', ss.WinH-245);
			 $("#gridTable4").jqGrid('setGridWidth', ss.WinW-30); 
			} 
			//执行大小
		function doResize5() { 
		var ss = getPageSize(); 
		//alert(ss.WinH);
		
			 $("#gridTable5").jqGrid('setGridHeight', ss.WinH-245);
			 $("#gridTable5").jqGrid('setGridWidth', ss.WinW-30); 
			} 
			//执行大小
		function doResize6() { 
		var ss = getPageSize(); 
		//alert(ss.WinH);
		
			 $("#gridTable6").jqGrid('setGridHeight', ss.WinH-245);
			 $("#gridTable6").jqGrid('setGridWidth', ss.WinW-30); 
			}  
		
	      //页面上的刷新按钮
			function shuaXin(){
				reset();
				gridSearch();
			}
	    
		 //--查询名称 高亮 开始---------------------------------------------------------------------
            function focusKey(e) {
                if (key.hasClass("empty")) {
                    key.removeClass("empty");
                }
            }
            function blurKey(e) {
                if (key.get(0).value === "") {
                    key.addClass("empty");
                }
            }
            var lastValue = "", nodeList = [], fontCss = {};
            
            function searchNode(e) {
                var zTree = $.fn.zTree.getZTreeObj("tree");
                var value = $.trim(key.get(0).value);
                var keyType = "";
                keyType = "name";
                if (lastValue === value) return;
                lastValue = value;
                if (value === "") return;
                updateNodes(false);
                nodeList = zTree.getNodesByParamFuzzy(keyType, value);
                updateNodes(true);
    
            }
            function updateNodes(highlight) {
                var zTree = $.fn.zTree.getZTreeObj("tree");
                for( var i=0, l=nodeList.length; i<l; i++) {
                    nodeList[i].highlight = highlight;
                    zTree.updateNode(nodeList[i]);
                }
            }
            function getFontCss(treeId, treeNode) {
                return (!!treeNode.highlight) ? {color:"#A60000", "font-weight":"bold"} : {color:"#333", "font-weight":"normal"};
            }
            function filter(node) {
                return !node.isParent && node.isFirstNode;
            }
    
            var key;
            $(document).ready(function(){
                $.fn.zTree.init($("#tree"), setting, zNodes);
                key = $("#key");
                key.bind("focus", focusKey)
                .bind("blur", blurKey)
                .bind("propertychange", searchNode)
                .bind("input", searchNode); 
            });
            //--查询名称 高亮 结束---------------------------------------------------------------------
		  <%
          
                String treeNode = "";
                String parentId = "";
                String taijiaId = "" ;
                String taijiaName = "";
                ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(application);
                ShebeichuzhiAction fixedAssets = (ShebeichuzhiAction)context.getBean("shebeichuzhiAction");
                	//类型
		    	String taijiaSql = " select distinct s.SHEBEITYPE  from GWM_SHEBEICHUZHITYPE s where s.SHEBEITYPE is not null";
		    	List list = fixedAssets.queryDataBySql(taijiaSql);
                if(null!=list&&list.size()>0){
                	treeNode +="{\"id\":\"设备处置台帐\",\"pId\":\"设备处置台帐\",\"name\":\"设备处置台帐\",\"title\":\"设备处置台帐\",\"open\":true},"; 
                    for(int i=0;i<list.size();i++){
                       if(null!=list.get(i)){
                            String taijiaType = list.get(i).toString();
                             String sql = " select  s.id  from GWM_SHEBEICHUZHITYPE s where s.SHEBEITYPE = '"+taijiaType+"'  order by s.id asc ";
                             List result = fixedAssets.queryDataBySql(sql);
                             treeNode +="{\"id\":\""+taijiaType+"\",\"pId\":\"设备处置台帐\",\"name\":\""+taijiaType+"\",\"title\":\""+taijiaType+"\",\"open\":false},";  
                       }
                    }
                }
                
               String newTreeNode=treeNode.substring(0,treeNode.length()-1);
               System.out.println(newTreeNode);
            %>
		var setting = {
                treeId:'tree',
                callback: {
                        onClick: zTreeOnClick,
                        beforeCollapse: beforeCollapse,
                        beforeExpand: beforeExpand,
                        onCollapse: onCollapse,
                        onExpand: onExpand
                    },
                view: {
                    selectedMulti: false
                },
                data: {
                    key: {
                        title: "name"
                    },
                    simpleData: {
                        enable: true,
                        idKey: "id",
                        pIdKey: "pId",
                        rootPId: -1
                    }
                                
                },
                view: {
                    fontCss: getFontCss
                }
            };
            
            function zTreeOnClick(event, treeId, treeNode) {
                tree_sel = treeNode;
                selecttreeId =treeNode.id;
                var pId = treeNode.pId;
                var taijianType="";
                var taijiaTestName ="";
                if(pId==-1){
                  taijianType=treeNode.name;
                  selecttreeId='';
                }else{
                   taijianType= pId;
                   if(treeNode.name.indexOf("--")>-1){
                      var arr= treeNode.name.split("--");
                      taijiaTestName = arr[0];
                   }else{
                     taijiaTestName = treeNode.name;
	                     if(taijiaTestName=="在用"){
	                     	zaiyong.style.display="",
	                     	xianzhi.style.display="none",
	                     	baofei.style.display="none",
	                     	jinyong.style.display="none",
	                     	fengcun.style.display="none",
	                     	guzhang.style.display="none",
	                     	jQuery("#gridTable").jqGrid('setGridParam',
					            {
					                url:common_contextPath+'/chuzhitaizhangAction!queryzaiyongdataList.action?temp='+Math.round(Math.random()*10000)
					            }).trigger("reloadGrid", [{page:1}]); 
	                     }else if(taijiaTestName=="闲置"){
	                     	xianzhi.style.display="",
	                     	zaiyong.style.display="none",
	                     	baofei.style.display="none",
	                     	jinyong.style.display="none",
	                     	fengcun.style.display="none",
	                     	guzhang.style.display="none",
	                     	jQuery("#gridTable2").jqGrid('setGridParam',
					            {
					                url:common_contextPath+'/chuzhitaizhangAction!queryxianzhidataList.action?temp='+Math.round(Math.random()*10000)
					            }).trigger("reloadGrid", [{page:1}]);
	                     }else if(taijiaTestName=="报废"){
	                     	baofei.style.display="",
	                     	jinyong.style.display="none",
	                     	fengcun.style.display="none",
	                     	guzhang.style.display="none",
	                     	xianzhi.style.display="none",
	                     	zaiyong.style.display="none",
	                     	jQuery("#gridTable3").jqGrid('setGridParam',
					            {
					                url:common_contextPath+'/chuzhitaizhangAction!querybaofeidataList.action?temp='+Math.round(Math.random()*10000)
					            }).trigger("reloadGrid", [{page:1}]);
	                     }else if(taijiaTestName=="禁用"){
	                     	baofei.style.display="none",
	                     	jinyong.style.display="",
	                     	fengcun.style.display="none",
	                     	guzhang.style.display="none",
	                     	xianzhi.style.display="none",
	                     	zaiyong.style.display="none",
	                     	jQuery("#gridTable4").jqGrid('setGridParam',
					            {
					                url:common_contextPath+'/chuzhitaizhangAction!queryzaiyongdataList.action?temp='+Math.round(Math.random()*10000)
					            }).trigger("reloadGrid", [{page:1}]);
	                     }else if(taijiaTestName=="封存"){
	                     	baofei.style.display="none",
	                     	jinyong.style.display="none",
	                     	fengcun.style.display="",
	                     	guzhang.style.display="none",
	                     	xianzhi.style.display="none",
	                     	zaiyong.style.display="none",
	                     	jQuery("#gridTable5").jqGrid('setGridParam',
					            {
					                url:common_contextPath+'/chuzhitaizhangAction!queryfengcundataList.action?temp='+Math.round(Math.random()*10000)
					            }).trigger("reloadGrid", [{page:1}]);
	                     }else if(taijiaTestName=="故障"){
	                     	baofei.style.display="none",
	                     	jinyong.style.display="none",
	                     	fengcun.style.display="none",
	                     	guzhang.style.display="",
	                     	xianzhi.style.display="none",
	                     	zaiyong.style.display="none",
	                     	jQuery("#gridTable6").jqGrid('setGridParam',
					            {
					                url:common_contextPath+'/chuzhitaizhangAction!queryzaiyongdataList.action?temp='+Math.round(Math.random()*10000)
					            }).trigger("reloadGrid", [{page:1}]);
	                     }
	                     var params = {  
	                "SHEBEITYPE":encodeURIComponent(selecttreeId)
		           	 	};
		                 var postData = $("#gridTable").jqGrid("getGridParam", "postData");
			             $.extend(postData, params);  //(9)将postData中的查询参数覆盖为空值
		                }
                }
            };
            
            var zNodes =[
                    <%=newTreeNode%>
            ];
        
            function showIconForTree(tetid, treeNode) {
                return !treeNode.isParent;
            };
            //展开/关闭按钮 开始-----------------------------------------------------------------------
            var log, className = "dark";
            function beforeCollapse(treeId, treeNode) {
                className = (className === "dark" ? "":"dark");
                showLog("[ "+getTime()+" beforeCollapse ]&nbsp;&nbsp;&nbsp;&nbsp;" + treeNode.name );
                return (treeNode.collapse !== false);
            }
            function onCollapse(event, treeId, treeNode) {
                showLog("[ "+getTime()+" onCollapse ]&nbsp;&nbsp;&nbsp;&nbsp;" + treeNode.name);
            }       
            function beforeExpand(treeId, treeNode) {
                className = (className === "dark" ? "":"dark");
                showLog("[ "+getTime()+" beforeExpand ]&nbsp;&nbsp;&nbsp;&nbsp;" + treeNode.name );
                return (treeNode.expand !== false);
            }
            function onExpand(event, treeId, treeNode) {
                showLog("[ "+getTime()+" onExpand ]&nbsp;&nbsp;&nbsp;&nbsp;" + treeNode.name);
            }
            function showLog(str) {
                if (!log) log = $("#log");
                log.append("<li class='"+className+"'>"+str+"</li>");
                if(log.children("li").length > 8) {
                    log.get(0).removeChild(log.children("li")[0]);
                }
            }
            function getTime() {
                var now= new Date(),
                h=now.getHours(),
                m=now.getMinutes(),
                s=now.getSeconds(),
                ms=now.getMilliseconds();
                return (h+":"+m+":"+s+ " " +ms);
            }
    
            function expandNode(e) {
                var zTree = $.fn.zTree.getZTreeObj("tree"),
                type = e.data.type,
                nodes = zTree.getSelectedNodes();
                if (type.indexOf("All")<0 && nodes.length == 0) {
                    alert("请先选择一个父节点");
                }
    
                if (type == "expandAll") {
                    zTree.expandAll(true);
                } else if (type == "collapseAll") {
                    zTree.expandAll(false);
                } else {
                    var callbackFlag = $("#callbackTrigger").attr("checked");
                    for (var i=0, l=nodes.length; i<l; i++) {
                        zTree.setting.view.fontCss = {};
                        if (type == "expand") {
                            zTree.expandNode(nodes[i], true, null, null, callbackFlag);
                        } else if (type == "collapse") {
                            zTree.expandNode(nodes[i], false, null, null, callbackFlag);
                        } else if (type == "toggle") {
                            zTree.expandNode(nodes[i], null, null, null, callbackFlag);
                        } else if (type == "expandSon") {
                            zTree.expandNode(nodes[i], true, true, null, callbackFlag);
                        } else if (type == "collapseSon") {
                            zTree.expandNode(nodes[i], false, true, null, callbackFlag);
                        }
                    }
                }
            }
            //展开/关闭按钮  结束---------------------------------------------------------------------
            $(document).ready(function(){
                treeObj = $.fn.zTree.init($("#tree"), setting, zNodes);
                $("#expandAllBtn").bind("click", {type:"expandAll"}, expandNode);
                $("#collapseAllBtn").bind("click", {type:"collapseAll"}, expandNode);
                
            }); 
              
	</script>	
	</head>
	<body>
	<form action="" method="post" id="form1" >
		<table width="470" border="0" cellspacing="0" cellpadding="0" >
			<tr>
				<td height="480px" width="200px" valign="top" style="background: #FFFFFF; ">
                    <div style="background-image: url('<%=request.getContextPath() %>/jslib/ztree/img/titlie.gif'); background-repeat:repeat-x;height: 20px; width: 200px; padding-top:5px;"> 
                       
                        <span >
                            <img onclick="return false;" src="<%=request.getContextPath() %>/jslib/ztree/img/add.png"  alt="闭合" title="点击关闭所有节点" id="collapseAllBtn"/>
                        </span> 
                        <span >
                            <img onclick="return false;"  src="<%=request.getContextPath() %>/jslib/ztree/img/delete.gif" alt="展开" title="点击展开所有节点"  id="expandAllBtn"/>
                        </span>
                    </div>
                    <div style="WIDTH: 200px; HEIGHT: 480px; OVERFLOW: auto; scrollbar-3dlight-color: #595959; scrollbar-arrow-color: #FFFFFF; scrollbar-base-color: #CFCFCF; scrollbar-darkshadow-color: #FFFFFF; scrollbar-face-color: #CFCFCF; scrollbar-highlight-color: #FFFFFF; scrollbar-shadow-color: #595959">
                        <div id="treeList" class="dtree">
                            <ul id="tree" class="ztree" style="width:235px;height:480px;overflow:auto;"></ul>
                        </div>
                    </div>
                </td>
			<td height="480px" width="260px" valign="top" style="background: #FFFFFF; border: #aaaaaa solid 1px;">
				<div id="zaiyong" style="width: 260px;" class="tableCont">
					<table id="gridTable"></table>
					<div id="gridPager"></div>
				</div>
				<div id="xianzhi" style="width: 260px;display: none;" class="tableCont">
					<table id="gridTable2" ></table>
					<div id="gridPager2"></div>
				</div>
				<div id="baofei" style="width: 260px;display: none;" class="tableCont">
					<table id="gridTable3" ></table>
					<div id="gridPager3"></div>
				</div>
				<div id="jinyong" style="width: 260px;display: none;" class="tableCont">
					<table id="gridTable4" ></table>
					<div id="gridPager4"></div>
				</div>
				<div id="fengcun" style="width: 260px;display: none;" class="tableCont">
					<table id="gridTable5"></table>
					<div id="gridPager5"></div>
				</div>
				<div id="guzhang" style="width: 260px;display: none;" class="tableCont">
					<table id="gridTable6" ></table>
					<div id="gridPager6"></div>
				</div>
		   </td>
		 </tr>
		</table>
	</form>
	</body>
</html>
